#1.(1)a_list = [1,2,3,2,2]
   #删除a_list中所有的2
# a_list = [1,2,3,2,2]
# while 1:
#     if 2 not in a_list:
#         break
#     else:
#         a_list.remove(2)
# print(a_list)


# 2.用内置函数compile创建一个文件xx.py,在文件里写你的名字,然后用eval
# #    函数读取文件中内容,并打印输出到控制台
# code = compile("open('Ice.py','w',encoding='utf-8').write('my name is Ice')",'Ice.py','exec')
# print(eval(code))
# code2 = eval("open('Ice.py','r',encoding ='utf-8').read()")
# print(code2)




# 3.写一个猜数字的游戏,给5次机会,每次随机生成一个整数,然后由控制台输入一个
#    数字,比较大小.大了提示猜大了,小了提示猜小了.猜对了提示恭喜你,猜对了.
#     退出程序,如果猜错了,一共给5次机会,5次机会用完程序退出.
# from random import randint
# num = randint(0, 10)
# print('~~~~~~~~~~~~~~~欢迎来到猜数字游戏~~~~~~~~~~~~~~~')
# user_num = int(input('请输入你所猜想的数字：'))
# count = 1
# while user_num != num and count < 5:
#     user_num = int(input('猜错了，请重新输入：'))
#     count += 1
#     if user_num == num:
#         print('恭喜你，猜对了！\n然而并没有什么卵用')
#     else:
#         if user_num < num:
#             print('猜小了猜小了')
#         else:
#             print('猜大了猜大了')
#print('游戏结束')

